package ltd.latewhale.whalenest.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import ltd.latewhale.whalenest.DTO.commentsDTO;
import ltd.latewhale.whalenest.mapper.ProjectInformationMapper;
import ltd.latewhale.whalenest.model.ProjectInformationDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProjectInformationService extends ServiceImpl<ProjectInformationMapper, ProjectInformationDO> {

    @Autowired
    private ProjectInformationMapper ProjectInformationMapper;

    public ProjectInformationDO getById(String id) {
        ProjectInformationDO ProjectInformations = ProjectInformationMapper.selectById(id);
        return  ProjectInformations;
    }

    public List<ProjectInformationDO> getProjectInformation() {
        List<ProjectInformationDO> ProjectInformations = ProjectInformationMapper.selectList(null);
        return ProjectInformations;
    }

    public Integer deleteId(Integer id) {

        return ProjectInformationMapper.deleteById(id);
    }

    public Integer postProjectInformation(ProjectInformationDO dto){

        return ProjectInformationMapper.insert(dto);
    }

    public Integer putProjectInformation(ProjectInformationDO dto){

        return ProjectInformationMapper.updateById(dto);
    }

    public List<commentsDTO> commentsData(Integer id){

        List<commentsDTO> comments = ProjectInformationMapper.commentsData(id);
        return comments;
    }

    public void psupportAdd(Integer id){
        ProjectInformationMapper.psupportAdd(id);
    }
}
